<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="java.util.Calendar"%>
<%
	String title = "信息综合系统";
%>
<%@ include file="/WEB-INF/jsp/header.jsp"%>
<title><%=title%>-标测库管理</title>
<head>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-itunes-app" content="app-id=429849944" />
<meta name="apple-touch-fullscreen" content="no" />
<meta content="telephone=no" name="format-detection" />
<meta name="apple-mobile-web-app-capable" content="no" />
</head>

<!-- BEGIN BODY -->
<body class="fixed-top">

	<jsp:include page="/common/headerPage.jsp"></jsp:include>
	<!-- BEGIN CONTAINER 容器 -->
	<div id="container" class="row-fluid">
		<!-- BEGIN SIDEBAR 侧边栏-->
		<jsp:include page="/common/left.jsp"></jsp:include>
		<!-- END SIDEBAR -->

		<!-- BEGIN PAGE -->
		<div id="main-content">
			<!-- BEGIN PAGE CONTAINER-->
			<div class="container-fluid">
				<!-- BEGIN PAGE HEADER-->
				<div class="row-fluid">
					<div class="span12">
						<!-- BEGIN PAGE TITLE & BREADCRUMB-->
						<h3 class="page-title">标测库管理</h3>
						<ul class="breadcrumb">
							<li><a
								href="${pageContext.request.contextPath}/user/index.do">首页</a> <span
								class="divider">/</span></li>
							<li class="active">标测库管理</li>
							<li class="pull-right search-wrap"><input type="button"
								class="btn  btn-info" onclick="toggleCondi();" id="show"
								value="隐藏筛选区域" /> &nbsp;&nbsp;
								<div class="btn-group pull-right">
									<button class="btn dropdown-toggle" data-toggle="dropdown">
										更多 <i class="icon-angle-down"></i>
									</button>
									<ul class="dropdown-menu pull-right">
										<li><a
											href="${pageContext.request.contextPath}/standard/download.do">下载已筛选的标测库记录</a></li>
										<li><a href="#" onclick="openUpload('标测库');">Excel批量上传N条</a></li>
										<li><a href="#" onclick="showOpen(0,'新增标测库');">页面新增一条</a></li>
									</ul>
								</div></li>
						</ul>
						<!-- END PAGE TITLE & BREADCRUMB-->
					</div>
				</div>
				<!-- END PAGE HEADER-->
				<!-- BEGIN BASIC PORTLET-->
				<div class="widget">
					<div class="row-fluid">
						<div class="clearfix">
							<form method="post" id="filterForm">
								<input type="text" class="span2" id="standardId" name="id"
									placeholder="请填写ID" data-provide="typeahead" data-items="4" />
								<select id="province" multiple="multiple" size="1"
									class="input-medium m-wrap" name="province">
									<option value="-1" disabled>请选择省份</option>
									<c:forEach items="${condiMap.shengfen}" var="shenfen"
										varStatus="status">
										<option value="${shenfen}">${shenfen}</option>
									</c:forEach>
								</select> <select id="product" multiple="true" size="1"
									class="input-medium m-wrap" name="product">
									<option value="-1" disabled>请选择品种</option>
									<option value="A">A</option>
									<option value="Y">Y</option>
									<option value="Z">Z</option>
									<option value="B">B</option>
								</select> <select id="pack" multiple="multiple" size="1"
									class="input-medium m-wrap" name="pack">
									<option value="-1" disabled>请选择包装</option>
									<option value = "12" >12</option>
			                         <option value = "24" >24</option>
			                         <option value = "36" >36</option>
			                         <option value = "48" >48</option>
			                         <option value = "20" >20</option>
			                         <option value = "40" >40</option>
			                         <option value = "30" >30</option>
			                         <option value = "60" >60</option>
			                         <option value = "5" >5</option>
			                         <option value = "10" >10</option>
			                         <option value = "240" >240</option>
			                         <option value = "480" >480</option>
								</select> <select id="mode" multiple="multiple" size="1"
									class="input-medium m-wrap" name="mode">
									<option value="-1" disabled>请选择模式</option>
									<option value="小包">小包</option>
									<option value="自营">自营</option>
									<option value="转移">转移</option>
									<option value="大包">大包</option>
									<option value="预付">预付</option>
									<option value="虚拟小包">虚拟小包</option>
									<option value="虚拟预付">虚拟预付</option>
									<option value="承包-预付">承包-预付</option>
									<option value="承包-小包">承包-小包</option>
								</select> <select id="qudao" multiple="multiple" size="1"
									class="input-medium m-wrap" name="qudao">
									<option value="-1" disabled>请选择条线</option>
									<option value="Rx">Rx</option>
									<option value="OTC">OTC</option>
								</select> <select id="ztype" multiple="multiple" size="1"
									class="input-medium m-wrap" name="ztype">
									<option value="-1" disabled>请选择渠道</option>
									<option value="T1">T1</option>
									<option value="T2">T2</option>
									<option value="T3">T3</option>
									<option value="T4">T4</option>
								</select> <input type="button" id="seach" name="seach" value="查询"
									class="btn  btn-primary" style="margin-bottom: 10px;"
									onclick="query(pNumber, pSize);"> <input type="reset"
									id="reset" name="reset" value="重置该页面" class="btn  btn-primary"
									style="margin-bottom: 10px;" onclick="resetf();" />
							</form>
						</div>
					</div>
					<div id="updateStandardForm" hidden>
						<div class="modal-body" style="height: 90%">
							<form action="" method="post" id="standardForm">
								<input id="standardIdU" value="" hidden="hidden" name="id">
								<span style="color:red;">*</span>&nbsp;请填写开始时间:
		                        <input type="text" id="startDateU" value='' class="Wdate noNull" name ="stime" style="width: 120px;"
		                               onfocus="WdatePicker({dateFmt:'yyyy/MM/dd',maxDate:'#F{$dp.$D(\'endDateU\')}',lang:'zh-cn',readOnly:true})"
		                               />
		                        <span style="color:red;">*</span>&nbsp;请填写结束时间:
		                        <input type="text" id="endDateU" value='' class="Wdate noNull" name="etime"style="width: 120px;"
		                               onfocus="WdatePicker({dateFmt:'yyyy/MM/dd',minDate:'#F{$dp.$D(\'startDateU\')}',lang:'zh-cn',readOnly:true})"
		                               /><br/>
								<span style="color: red;">*</span>&nbsp; 请填写标准测算价： <input
									type="text" class="span2 noNull" id="bzcsjU" name="bzcsj"
									onblur="if(!/^[0-9]+([.]{1}[0-9]+){0,1}$/.test(this.value)){layer.msg('只能输入【数字】');this.value='';}"
									/>
								<span style="color: red;">*</span>&nbsp;请选择省份： <select
									id="provinceU" size="1" class="input-medium m-wrap"
									name="province">
									<c:forEach items="${provinces}" var="shenfen"
										varStatus="status">
										<option value="${shenfen}">${shenfen}</option>
									</c:forEach>
								</select> <br />
								<span style="color: red;">*</span>&nbsp;请选择品种： <select
									id="productU" size="1" class="input-medium m-wrap"
									name="product">
									<option value="A">A</option>
									<option value="Y">Y</option>
									<option value="Z">Z</option>
									<option value="B">B</option>
								</select> <span style="color: red;">*</span>&nbsp;请选择包装： <select
									id="packU" size="1" class="input-medium m-wrap" name="pack">
									<option value = "12" >12</option>
		                            <option value = "24" >24</option>
		                            <option value = "36" >36</option>
		                            <option value = "48" >48</option>
		                            <option value = "20" >20</option>
		                            <option value = "30" >30</option>
		                            <option value = "40" >40</option>
		                            <option value = "60" >60</option>
		                            <option value = "5" >5</option>
			                        <option value = "10" >10</option>
			                        <option value = "240" >240</option>
			                        <option value = "480" >480</option>
								</select> </br> <span style="color: red;">*</span>&nbsp;请选择模式： <select
									id="modeU" size="1" class="input-medium m-wrap" name="mode">
									<option value="小包">小包</option>
									<option value="自营">自营</option>
									<option value="转移">转移</option>
									<option value="大包">大包</option>
									<option value="预付">预付</option>
									<option value="虚拟小包">虚拟小包</option>
									<option value="虚拟预付">虚拟预付</option>
									<option value="承包-预付">承包-预付</option>
									<option value="承包-小包">承包-小包</option>
								</select> <span style="color: red;">*</span>&nbsp;请选择条线： <select
									id="qudaoU" size="1" class="input-medium m-wrap" name="qudao">
									<option value="Rx">Rx</option>
									<option value="OTC">OTC</option>
								</select> <br />
								<span style="color: red;">*</span>&nbsp;请选择渠道： <select
									id="ztypeU" size="1" class="input-medium m-wrap" name="ztype">
									<option value="T1">T1</option>
									<option value="T2">T2</option>
									<option value="T3">T3</option>
									<option value="T4">T4</option>
								</select>
							</form>
						</div>
					</div>
					<div id="uploadFileForm" hidden>
						<div class="modal-body">
							<form
								action="${pageContext.request.contextPath}/standard/upload.do?i=<%=Math.random() %>"
								method="post" id="uploadForm" enctype="multipart/form-data">
								点击该按钮选择文件:<input type="file" name="excelFile"
									multiple="multiple" class="input-medium" id="file"><br />

							</form>
						</div>
					</div>

					<div id="errorInfoDiv" hidden="hidden">
						<table class="table table-striped table-hover table-bordered"
							style="font-size: 11px; color: red; width: 750px; margin: 12px;">
							<thead>
								<tr>
									<td>出错行号</td>
									<td>出错标题</td>
									<td>标准字段</td>
									<td>错误字段</td>
								</tr>
							</thead>
							<tbody id="error-body"></tbody>
						</table>
					</div>
					
					<div class="row-fluid">
                	<div class="span12">
                    <!-- BEGIN ALERTS PORTLET-->
                    <div class="widget blue">
                        <div class="widget-title">
                            <h4><i class="icon-reorder"></i>
                                <a href="javascript:;" id="getProp" style ="color:white;">复制</a>
                            </h4>
                            <span class="tools">
								<a href="javascript:;" class="icon-chevron-down"></a>
							</span>
                        </div>
				    
                        <div class="widget-body" style="overflow:auto">
	                        <div class="pageBottom" style="text-align:center;">
	                            <input type="hidden" id="page-size" value="0"/>
	                            <div id="callBackPager" class="paging_bootstrap pagination"></div> 
	                        </div>
                        	<table class="table table-striped table-hover table-bordered" width="640px;"
                           		style="table-layout:fixed">
                                <thead>
                                <tr>
									<th style="width:15px;"><input type="checkbox" name="choiceAll" value="all" id ="allAndNotAll"/></th>
                                    <th width="70px">id</th>
									<th width="70px">省份</th>
									<th width="70px">品种</th>
									<th width="70px">包装</th>
									<th width="70px">模式</th>
									<th width="70px">渠道</th>
									<th width="70px">条线</th>
									<th width="70px">开始时间</th>
                                    <th width="70px">结束时间</th>
									<th width="70px">标准测算价</th>
								</tr>
                                </thead>
                                <tbody id="distribute-body">
                        		</tbody>
                            </table>
                        </div>

                    </div>
                    <!-- END ALERTS PORTLET-->
                	</div>
            	</div>
				</div>
				<!-- END BASIC PORTLET-->
			</div>
		</div>
	</div>
	</div>

	<!-- BEGIN FOOTER -->
	<jsp:include page="/common/footer.jsp"></jsp:include>
	<!-- END FOOTER -->

	<!-- BEGIN JAVASCRIPTS -->
	<!-- Load javascripts at bottom, this will reduce page load time -->
	<%--<script src="js/jquery-1.8.3.min.js"></script>--%>
	<script src="${pageContext.request.contextPath}/js/jquery-1.7.1.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/js/jquery.nicescroll.js"
		type="text/javascript"></script>
	<script type="text/javascript"
		src="${pageContext.request.contextPath}/js/jquery-ui-1.9.2.custom.min.js"></script>
	<script type="text/javascript"
		src="${pageContext.request.contextPath}/js/jquery.slimscroll.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/fullcalendar.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/js/jquery.easy-pie-chart.js"
		type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/js/jquery.sparkline.js"
		type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/js/Chart.js"></script>
	<script
		src="${pageContext.request.contextPath}/js/jquery.scrollTo.min.js"></script>
	<!--common script for all pages-->
	<script src="${pageContext.request.contextPath}/js/common-scripts.js"></script>

	<script type="text/javascript"
		src="${pageContext.request.contextPath}/js/layer/layer.js"></script>
	<%--<script src = "${pageContext.request.contextPath}/js/jquery.min.js" > </script>--%>
	<script type="text/javascript"
		src="${pageContext.request.contextPath}/js/bootstrap-multiselect.js"></script>
	<link rel="stylesheet"
		href="${pageContext.request.contextPath}/css/bootstrap-multiselect.css"
		type="text/css" />

	<script
		src="${pageContext.request.contextPath}/js/bootstrap-typeahead.js"></script>
	<script type="text/javascript"
		src="${pageContext.request.contextPath}/js/extendPagination.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="http://img3.job1001.com/js/ZeroClipboard/jquery.zclip.min.js"></script>
	
	<!-- END JAVASCRIPTS -->
	<!-- 自定义的script方法 -->
	<script type="text/javascript">
		$(document).ready(function() {
			$("#show").click(function() {
				$(".clearfix").slideToggle();
			});
			/*通过ID查询*/
			$('#province').multiselect({
				includeSelectAllOption : true,
				nonSelectedText : '请选择省份',
				enableFiltering : true,
				maxHeight : 300,
				buttonWidth : '110px'
			});
			$('#product').multiselect({
				includeSelectAllOption : true,
				nonSelectedText : '请选择品种',
				enableFiltering : true,
				maxHeight : 300,
				buttonWidth : '110px'
			});
			$('#pack').multiselect({
				includeSelectAllOption : true,
				nonSelectedText : '请选择包装',
				enableFiltering : true,
				maxHeight : 300,
				buttonWidth : '110px'
			});
			$('#mode').multiselect({
				includeSelectAllOption : true,
				nonSelectedText : '请选择模式',
				enableFiltering : true,
				maxHeight : 300,
				buttonWidth : '110px'
			});
			$('#qudao').multiselect({
				includeSelectAllOption : true,
				nonSelectedText : '请选择条线',
				enableFiltering : true,
				maxHeight : 300,
				buttonWidth : '110px'
			});
			$('#ztype').multiselect({
				includeSelectAllOption : true,
				nonSelectedText : '请选择渠道',
				enableFiltering : true,
				maxHeight : 300,
				buttonWidth : '110px'
			});
		});
		var mgr = ${condiMap.mgr};
		$('#mgr').typeahead({
			source : mgr
		})
		
		if ( window.clipboardData ) {
        $('#getProp').click(function() {
            var ids = getProp();  
            if(selectedIds.trim().length>0){
       		   ids = selectedIds;
       	    }
            if(ids.trim().length>0){
                window.clipboardData.setData("Text", ids);
                $("#allAndNotAll").attr("checked", false);  
                $("input[name='choice']:checkbox").each(function(){ 
                    $(this).attr("checked", false);  
              	});
                layer.msg("复制成功！");
            }else{
                layer.alert("您没有选中行！");
            }
        });
    } else {
        $("#getProp").zclip({
            path:'http://img3.job1001.com/js/ZeroClipboard/ZeroClipboard.swf',
            copy:function(){
                   var ids = getProp();  
                   if(selectedIds.trim().length>0){
              		   ids = selectedIds;
              	    }
                   if(ids.trim().length>0){
                       return ids;
                   }else{
                       layer.msg("您没有选中行！");
                   }
                },
            afterCopy:function(){
            	$("#allAndNotAll").attr("checked", false);  
                $("input[name='choice']:checkbox").each(function(){ 
                    $(this).attr("checked", false);  
              	});
            	layer.msg("复制成功！");
            }
        });
    }
	</script>

	<script type="text/javascript">
		function query(pageNumber, pageSize) {
	        var url = "${pageContext.request.contextPath }/standard/selectStandardList.do?pageNumber="
	            + pageNumber + "&pageSize=" + pageSize;
	        var params = $("#filterForm").serialize();
	        queryList(url,params);
	    }
	
		/* //上传文件的大小和格式校验
		function uploadFile() {
			var ret = false;
			var maxsize = 100 * 1024 * 1024;//100M
			layer.load(2);
			var name = $("#file").val();
			var ext = name.substr(name.lastIndexOf('.') + 1);
			if (ext != 'xls' && ext != 'xlsx') {//文件格式验证
				layer.msg("文件后缀只能为.xls和.xlsx!");
				$("#file").val('');
				layer.closeAll('loading');
				clicked = true;
				return ret;
			}
			var names = document.getElementById("file");
			var sizes = names.files[0].size;
			if (maxsize < sizes) { //文件大小验证
				$("#file").val('');
				layer.msg("文件大小不能超过100M!");
				clicked = true;
				return ret;
			}
			var formData = new FormData($("#uploadForm")[0]);
			layer.msg('拼命执行中，请稍等……', {icon: 16}, function(){
	        	layer.closeAll();
	        	layer.load(2);
	        	$.ajax({
					type : "POST",
					url : $('#uploadForm').attr("action"),
					data : formData,
					cache : false,
					async : true,
					dataType : "json",
					processData : false,
					contentType : false,
					success : function(result) {
						alert(result);
						var code = result.code;
						$("#file").val("");
						if (code == -2) {//表示上传的excel格式有错误
							errorInfo(result.msg);
							ret = false;
						} else if (code == -4) {
							layer.alert("您没有操作权限！！！");
						} else if (code == -3) { //登录用户失效
							layer.alert(result.message
								+ '</br>点击前往登录页面:'
								+ '<a href="${pageContext.request.contextPath}/login.jsp">登录页面</a>');
							ret = false;
						} else if (code == -4) {
							layer.alert("您没有操作权限！！！");
						} else if (code == -1) {
							layer.alert(result.msg);
						} else { //上传成功
							layer.closeAll();
							layer.alert("操作成功！\n" + result.msg);
							ajaxGetStandard(1,8);
							ret = "success";
						}
						return ret;
					},
					error : function(e) {
						layer.closeAll('loading');
						layer.msg("操作失败！");
						ret = fasle;
					}
				});
			});
			layer.closeAll('loading');
			return ret;
		}
 */
		/* function checkNull(type) {
			var noNull = $(".noNull");
			if (type == 'change') {
				noNull = $("#standardForm").find(".noNull");
			}
			for (var i = 0; i < noNull.length; i++) {
				if (noNull[i].value == null || noNull[i].value == undefined
						|| noNull[i].value == "") {
					layer.msg("请完善带*号项！");
					return "false";
				}
			}
			return "true";
		} */

		/* //异步请求获取符合筛选条件的流向记录
		function ajaxGetStandard(pageNumber, pageSize) {
			//通过ID查询	条线	经理	大区	片区	省份	地市	区县
			var standardId = $("#standardId").val();
			var product = $("#product").next("div").find("button")
					.attr("title");
			var pack = $("#pack").next("div").find("button").attr("title");
			var province = $("#province").next("div").find("button").attr(
					"title");
			var mode = $("#mode").next("div").find("button").attr("title");
			var qudao = $("#qudao").next("div").find("button").attr("title"); //条线
			var ztype = $("#ztype").next("div").find("button").attr("title"); //渠道

			var condiMap = {
				id : standardId,
				product : product,
				province : province,
				pack : pack,
				mode : mode,
				qudao : qudao,
				ztype : ztype,
				pageNumber : pageNumber,
				pageSize : pageSize
			}
			//layer.alert(c1ondiMap);
			layer.load(2);
			$
					.ajax({
						type : "POST",
						url : "${pageContext.request.contextPath }/standard/selectStandardList.do?t="
								+ Math.random(),
						data : condiMap,
						dataType : "json",
						success : function(result) {
							$("#distribute-body").html("");
							$(".pageBottom").css('display', 'none');
							if (result != null) {
								if (result.code == -3) { //登录用户失效
									layer.alert(result.message
											+ '</br>点击前往登录页面:'
											+ '<a href="login.jsp">登录页面</a>');
								} else if (result.total == 0) {
									layer.msg("筛选后的记录数为零！")
								} else {
									if (result.pageNum == 1) {
										$('#callBackPager').extendPagination(
												{
													totalCount : result.total,
													showPage : 5,
													pageNum : result.pageNum,
													limit : result.pageSize,
													callback : function(curr,
															limit, totalCount) {
														ajaxGetStandard(curr,
																limit);
													}
												});
									}
									$(".pageBottom").css('display', 'block');
									createTable(result.pageNum,
											result.pageSize, result.total,
											result.list);
									$("#pageNumber").text(result.pageNum);
								}
							} else {
								layer.closeAll('loading');
								layer.alert("查询结果为null！");
							}
							layer.closeAll('loading');
						},
						error : function(e) {
							layer.closeAll('loading');
							layer.msg("操作失败！");
						}
					});
		};
 */
		//动态创建table
		function createTable(currPage, limit, total, items) {
			var html = [], showNum = limit;
			if (total - (currPage * limit) < 0)
				showNum = total - ((currPage - 1) * limit);
			for (var i = 0; i < showNum; i++) {
				html.push("<tr ondblclick=\"showOpen('" + items[i].id
						+ "','修改标测库')\" >");
				html.push('<td><input type="checkbox" name="choice" value="'+items[i].id+'"/></td>');
	            html.push('<td>' + formatData(items[i].id) + '</td>');
				html.push('<td>' + formatData(items[i].province) + '</td>');
				html.push('<td>' + formatData(items[i].product) + '</td>');
				html.push('<td>' + formatData(items[i].pack) + '</td>');
				html.push('<td>' + formatData(items[i].mode) + '</td>');
				html.push('<td>' + formatData(items[i].ztype) + '</td>');
				html.push('<td>' + formatData(items[i].qudao) + '</td>');
				html.push('<td>' + formatData(items[i].stime) + '</td>');
	            html.push('<td>' + formatData(items[i].etime) + '</td>');
				html.push('<td>' + formatData(items[i].bzcsj) + '</td>');
				html.push('</tr>');
			}
			var mainObj = $('#distribute-body');
			mainObj.empty();
			mainObj.html(html.join(''));
		};

		/* //格式化无效数据
		function formatData(data) {
			if (data && data != null) {
				return data;
			} else {
				return "";
			}
		} */
	</script>
	<!-- END BODY -->
	<script>
		var htmls = $("#updateStandardForm").html();
		var uploadFileHtml = $("#uploadFileForm").html();
		var ret = null;
		function showOpen(id, type) {
			if ("修改标测库" == type) {
				$
						.ajax({
							type : "POST",
							async : false,//同步
							url : "${pageContext.request.contextPath }/standard/selectStandardByID.do?t="
									+ Math.random(),
							data : {
								standardId : id
							},
							dataType : "json",
							success : function(result) {
								if (result.code == -3) { //登录用户失效
									layer.alert(result.message
											+ '</br>点击前往登录页面:'
											+ '<a href="login.jsp">登录页面</a>');
								} else {
									ret = result;
								}
							},
							error : function(e) {
								;
								layer.closeAll('loading')
								layer.msg("操作失败！");
							}
						});
			}
			$("#updateStandardForm").remove();
			layer
					.open({
						title : [
								type
										+ '<span style="color:red;font-size:12px;margin-left:10px;">*表示该项必填</span>',
								'font-size:18px;' ],
						type : 1,
						content : htmls, //这里content是一个普通的String
						btn : [ '确认', '取消' ],
						yes : function(index, layero) {
							layer.load(2);
							var ret = checkNull('standardForm');
							if (ret == "false") {
								return true;
							}
							var action = "";
							if ("新增标测库" == type) {
								action = "${pageContext.request.contextPath}/standard/changeStandard.do?flag=N&t="
										+ Math.random();
							} else if ("修改标测库" == type) {
								action = "${pageContext.request.contextPath}/standard/changeStandard.do?flag=E&t="
										+ Math.random()
							}
							$.ajax({
								type : "POST",
								url : action,
								data : $('#standardForm').serialize(),
								dataType : "json",
								success : function(result) {
									layer.closeAll('loading');
									var code = result.code;
									if (code == -3) { //登录用户失效
										layer
												.alert(result.message
														+ '<br/>点击前往登录页面:'
														+ '<a href="${pageContext.request.contextPath}/login.jsp">登录页面</a>');
									} else if (code == -4) {
										layer.alert("您没有操作权限！！！");
									} else if (code > 0) {
										layer.closeAll();
										layer.msg(result.msg);
										query(1,8);
									} else if (code == -2) { //excel校验不通过
										errorInfo(result.msg);
									} else if (code == -1) { // 有错误
										layer.alert(result.msg);
									}
									layer.closeAll('loading');
									return false;
								},
								error : function(e) {
									layer.closeAll('loading');
									layer.msg("操作失败！");
									return true;
								}
							});
							
							return false;
						},
						btn2 : function(index, layero) {
							layer.closeAll('loading');
						},
						cancel : function() {
							layer.closeAll('loading');
						},
						area : [ '800px', '500px' ]
					});
			$("#standardIdU").val(id); //动态赋值ID
			if (ret != null && type == '修改标测库') {
				$("#provinceU").val(ret.province);
				$("#productU").val(ret.product);
				$("#packU").val(ret.pack);
				$("#modeU").val(ret.mode);
				$("#ztypeU").val(ret.ztype);
				$("#qudaoU").val(ret.qudao);
				$("#bzcsjU").val(ret.bzcsj);
				$("#endDateU").val(ret.etime);
	            $("#startDateU").val(ret.stime);
			}
		}

		//查询按钮绑定回车键
		$("body").keydown(function() {
			if (event.keyCode == "13") {//keyCode=13是回车键
				$('#seach').click();
			}
		});

		/*function errorInfo(items) {
			var html = [];
			for (var i = 0; i < items.length; i++) {
				html.push("<tr>");
				html.push('<td>'
						+ items[i].err_num.substring(items[i].err_num
								.indexOf("：") + 1) + '</td>');
				html.push('<td>' + formatData(items[i].err_title) + '</td>');
				html.push('<td style="color:#479DA4;">'
						+ formatData(items[i].err_msg) + '</td>');
				html.push('<td>' + formatData(items[i].err_field) + '</td>');
				html.push('</tr>');
			}
			var mainObj = $('#error-body');
			mainObj.empty();
			mainObj.html(html.join(''));

			var errorInfoHtml = $("#errorInfoDiv").html();
			layer.open({
				title : [ '错误信息', 'font-size:18px;' ],
				type : 1,
				content : errorInfoHtml //这里content是一个普通的String
				,
				cancel : function() {
					layer.closeAll('loading');
					openUpload('标测库');
					return true;
				},
				area : [ '800px', '400px' ]
			});

			$("#error-info").removeAttr("hidden");
		}*/

		/* //重置筛选条件
		function resetf() {
			location.reload();
		} */
		//是否已经点击了确定按钮，防止用户重复点击
		var clicked = false;
		//上传
		/*function openUpload() {
			clicked = true;
			$("#uploadFileForm").remove();
			layer.open({
				title : [ '请选择目标【标测库Excel】文件', 'font-size:18px;' ],
				type : 1,
				content : uploadFileHtml, //这里content是一个普通的String
				btn : [ '确认', '取消' ],
				yes : function(index, layero) {
					if(clicked){
	            		clicked = false;
						var ret = uploadFile();
						if (ret == 'success') {
							return false; //关闭框
						}
					}
				},
				btn2 : function(index, layero) {
					layer.closeAll('loading');
				},
				cancel : function() {
					layer.closeAll('loading');
				},
				area : [ '400px', '230px' ]
			});
		}*/
		
	/* function getProp(){
        obj = document.getElementsByName("choice");
        var check_val = "";
        for(k in obj){
            if(obj[k].checked)
                check_val = check_val+" "+ obj[k].value
        }
        return check_val;
    } */
	//所有选中的id
	var selectedIds = "";
    //全选或全不选
   /*  $("#allAndNotAll").click(function() { 
        if (this.checked){  
            $("input[name='choice']:checkbox").each(function(){ 
                  $(this).attr("checked", true);  
            });
            layer.msg('拼命执行中，请稍等……', {icon: 16}, function(){
	        	layer.closeAll();
	        	layer.load(2);
	        	//发送异步请求，获取数据
	            sendRequest(pageContextPath + "/standard/selectIds.do", null, function (jsonData) {
	                selectedIds = jsonData.ids;
	                layer.closeAll();
	            });
	        });
            
        } else {   
            $("input[name='choice']:checkbox").each(function() {   
                  $(this).attr("checked", false);  
            });
            selectedIds="";
        }  
    }); */
	</script>
	<script src="${pageContext.request.contextPath}/javascript/httpService.js"></script>
</body>
</html>